package smashedapples.core
{
	import flash.utils.getQualifiedClassName;

	
	public class Controller extends NonVisualComponent
	{
		public function Controller()
		{
			super();
		}
		
		public function execute(command:Command):void
		{	
			var handlerName : String = command.type;
	
			trace(handlerName +  "(" + flash.utils.getQualifiedClassName(command.event) + ")");
			
			if( this.hasOwnProperty(handlerName))
			{	
				var method : Function =  this[handlerName] as Function;
				method.apply( this, [command] );
			}
		}
		
	}
}